import { pipeline } from '@huggingface/transformers';

class MyTranslationPipeline {
    static task = 'translation';
    static model = 'Xenova/nllb-200-distilled-600M';
    static instance = null;

    static async getInstance(progress_callback = null) {
        if (this.instance === null) {
        this.instance = pipeline(this.task, this.model, { progress_callback });
        }

        return this.instance;
    }
}

export default {
  classifier: MyTranslationPipeline.getInstance
}